<?php
//echo 'tes aja'; exit;
    //QUERY 1
    foreach ($getDetail as $a) {
        $aParkirdNik  		= $a["PARKIRD_NIK"];
    	$aParkirdUntukNik  	= $a["PARKIRD_UNTUK_NIK"];
    	$aParkirdAtasanNik  = $a["PARKIRD_ATASAN_NIK"];
    	$aParkirdType  		= $a["PARKIRD_TYPE"];
    	$aParkirdPlat  		= $a["PARKIRD_PLAT"];
    	$aParkirdStnk  		= $a["PARKIRD_STNK"];
    	$aParkirdDate  		= $a["PARKIRD_DATE"];
    	$aParkirdDescription= $a["PARKIRD_DESCRIPTION"];
    	$aParkirdFile  		= $a["PARKIRD_FILE"];
    	$aParkirdUseBy  	= $a["PARKIRD_USE_BY"];
    	$aParkirdType1  	= $a["PARKIRD_TYPE_1"];
    	$aParkirdPlat1  	= $a["PARKIRD_PLAT_1"];
    	$aParkirdStnk1  	= $a["PARKIRD_STNK_1"];
    	$aParkirdFlag1  	= $a["PARKIRD_FLAG_1"];
    	$aParkirdType2  	= $a["PARKIRD_TYPE_2"];
    	$aParkirdPlat2  	= $a["PARKIRD_PLAT_2"];
    	$aParkirdStnk2  	= $a["PARKIRD_STNK_2"];
    	$aParkirdFlag2  	= $a["PARKIRD_FLAG_2"];
    	$aParkirdType3  	= $a["PARKIRD_TYPE_3"];
    	$aParkirdPlat3  	= $a["PARKIRD_PLAT_3"];
    	$aParkirdStnk3  	= $a["PARKIRD_STNK_3"];		
    	$aParkirdFlag3  	= $a["PARKIRD_FLAG_3"];
    	$aParkirdType4  	= $a["PARKIRD_TYPE_4"];
    	$aParkirdPlat4  	= $a["PARKIRD_PLAT_4"];
    	$aParkirdStnk4  	= $a["PARKIRD_STNK_4"];		
    	$aParkirdFlag4  	= $a["PARKIRD_FLAG_4"];
    	$aContractSdate  	= $a["CONTRACT_SDATE"];
    	$aContractEdate  	= $a["CONTRACT_EDATE"];
    	
    	$aName  			= $a["NIKNAME"];
    	$aOrg  				= $a["NIKORG"];
    	$aJob  				= $a["NIKJOBPOSITION"];
    	$cName  	  	    = $a["UNIKNAME"];
    	$cOrg  			    = $a["UNIKORG"];
    	$cJob  			    = $a["UNIKJOBPOSITION"];
    }
    
?>

<script>
    function cancel() {
        $.post("<?= site_url() ?>search_global", function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        });
    }
    function closeSrnKrjPrkSave() {
        $radioChecked='';
        if (document.getElementById("pApprovalY").checked == true){
            $radioChecked = "Y"; 
        }
        else{
            $radioChecked = "N";
        }
        
        $.post("<?= site_url() ?>search_global/closing_reqSave", {
            pCtrlID: $('#pCtrlID').val(),
            pCType: $('#pCType').val(),
            pApproval: $radioChecked 
            //pComment: $('#pComment').val(),
            //pAccesNo: $('#pAccesNo').val()
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        }
        );
    }
</script>

<form id="formarea" role="form" method="post" action="#">
<input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" />
<input type="hidden" value="<?php echo $cType; ?>" id="pCType" />
<div class="col-md-offset-0" id="top">
    <div class="col-md-11">
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Request By </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">NIK</label>
    						<div class="col-md-9"><?php echo $aParkirdNik;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9"><?php echo $aName;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $aOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $aJob;?></div>
				        </div>
                    </div>                   
                </div>
                
            </div>
        </div>
        
        <div class="panel panel-default">
			<div class="panel-heading">
			<h4 class="panel-title"><b> Requestor </b></h4>
			</div>
			<div class="panel-body">
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nik</label>
    						<div class="col-md-9"><?php echo $aParkirdUntukNik;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Nama</label>
    						<div class="col-md-9"><?php echo $aParkirdUseBy;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Departemen</label>
    						<div class="col-md-9"><?php echo $cOrg;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Position</label>
    						<div class="col-md-9"><?php echo $cJob;?></div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Kendaraan</label>
    						<div class="col-md-9"><?php echo $aParkirdType;?></div>
				        </div>
                    </div>                   
                </div>
                
                <?php
                if (!empty($aParkirdPlat1) || !empty($aParkirdPlat2) || !empty($aParkirdPlat3)) {
                    ?>
                    <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
                                    <thead>
                                        <tr>
                                            <th class="tblhead" style="width:5%;text-align:center;">No</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">No Kendaraan</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">No STNK</th>
                                            <th class="tblhead" style="width:10%;text-align:center;">Aktif</th>
                                        </tr>
                                    </thead>
                                    
                                
                    <?php
                    if(!empty($aParkirdPlat1)){
                        ?>
                        <tbody>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo ++$i; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdPlat1; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdStnk1; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdFlag1; ?></td>
                                        </tr>
                                    </tbody>
                        <?php
                    }   
                    if(!empty($aParkirdPlat2)){
                        ?>
                        <tbody>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo ++$i; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdPlat2; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdStnk2; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdFlag2; ?></td>
                                        </tr>
                                    </tbody>
                        <?php
                    } 
                    if(!empty($aParkirdPlat3)){
                        ?>
                        <tbody>
                                        <tr>
                                            <td style="font-size:5;"><?php echo ++$i; ?></td>
                                            <td style="font-size:35px;"><?php echo $aParkirdPlat3; ?></td>
                                            <td style="font-size:30px;"><?php echo $aParkirdStnk3; ?></td>
                                            <td style="font-size:30px;"><?php echo $aParkirdFlag3; ?></td>
                                        </tr>
                                    </tbody>
                        <?php
                    }
                    ?>
                        </table>
                    </div>
                    <?php
                }
                if (!empty($aParkirdPlat4)) {
                        ?>
                        <div class="table-responsive">
                                <table class="table table-bordered table-condensed table-striped" style="background:#f9f9f9;">
                                    <thead>
                                        <tr>
                                            <th class="tblhead" style="width:5%;text-align:center;">No</th>
                                            <th class="tblhead" style="width:50%;text-align:center;">No Kendaraan</th>
                                            <th class="tblhead" style="width:45%;text-align:center;">No STNK</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr>
                                            <td style="font-size:10px;"><?php echo ++$i; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdPlat4; ?></td>
                                            <td style="font-size:10px;"><?php echo $aParkirdStnk4; ?></td>
                                        </tr>
                                    </tbody>
                                </table>
                        </div>
                        <?php
                }
                ?>
                  
                
                
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3">Closing Order</label>
    						<div class="col-md-9">
                            <input type="radio" name="radioApp" id="pApprovalY" value="Y"/>Yes
                            <input type="radio" name="radioApp" id="pApprovalN" value="N" checked=""/>No
                            </div>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
				        </div>
                    </div>                   
                </div>
                <div class="row"> 
                    <div class="col-sm-12">
                        <div class="form-group">
                            <label class="control-label col-md-3"></label>
    						<div class="col-sm-2">
                                <button type="button" class="btn btn-primary btn-block" onclick="closeSrnKrjPrkSave();">Submit</button>
                            </div>
                            <div class="col-sm-2">
                                <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                            </div>
				        </div>
                    </div>                   
                </div>
            </div>
        </div>
    
    </div>
</div>
</form>
